package com.bjsxt.collection;

import java.util.HashMap;
import java.util.Map;
import java.util.ServiceConfigurationError;
import java.util.Set;

public class HashMapTest {
    public static void main(String[] args) {
        Map<String ,String> map = new HashMap<>();

        map.put("a","A");
        String value= map.put("a","B");
        System.out.println(value);
        System.out.println(map.get("a"));
        System.out.println(map);
        map.put("b","B");
        map.put("d","D");
        map.put("c","C");


        Set<String> keys=map.keySet();
        System.out.println(keys);

        Set<Map.Entry<String,String>> entrySet= map.entrySet();

        System.out.println(entrySet);
        for (Map.Entry<String,String> entry:entrySet){
            System.out.println(entry.getKey());
            System.out.println(entry.getValue());
        }

        Map<String,String> map1 = new HashMap<>();
        map1.put("f","w");
        map1.put("a","AA");
        map1.put("g","G");
        System.out.println(map1);
        map1.putAll(map);
        System.out.println(map);
        System.out.println(map1);

        map1.remove("a");
        System.out.println(map1);

        System.out.println(map.containsKey("a"));
        System.out.println(map.containsValue("EE"));


//






    }
}
